/*
 * InfoWindow.java
 *
 * Created on 16 de octubre de 2006, 21:52
 */

package ub.es.ubictionary.visual;

import java.awt.Point;
import javax.swing.JOptionPane;

/**
 *
 * @author  aram
 */
public class InfoWindow extends javax.swing.JDialog {
    
    /** Creates new form InfoWindow */
    public InfoWindow(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        lblText = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/waiting.gif"))); // NOI18N

        lblText.setText("<html>Adding new dictionary.<br>This proces may take a while.<br>Please wait ...</html>");
        lblText.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(30, 30, 30)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(lblText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 288, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(30, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(35, 35, 35)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(lblText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .add(jLabel1))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    public  void  showWindow(String message){
        lblText.setText(message);
        int ancho = this.getParent().getWidth();
        int alto = this.getParent().getHeight();
        Point p = this.getParent().getLocation();
        this.setLocation( ((int)p.getX()) + ( ancho-this.getWidth())/2, ((int) p.getY()) + (alto - this.getHeight())/2 );
        this.setVisible(true);
    }
    
    public void hideWindow(){
        this.setVisible(false);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel lblText;
    // End of variables declaration//GEN-END:variables
    
}
